package com.example.administrator.familfinalcialmanagement.greendao.gen;

import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;

import com.example.administrator.familfinalcialmanagement.bean.PayInfoBean;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "PAY_INFO_BEAN".
*/
public class PayInfoBeanDao extends AbstractDao<PayInfoBean, Long> {

    public static final String TABLENAME = "PAY_INFO_BEAN";

    /**
     * Properties of entity PayInfoBean.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Id = new Property(0, long.class, "id", true, "_id");
        public final static Property Title = new Property(1, String.class, "title", false, "TITLE");
        public final static Property Info = new Property(2, String.class, "info", false, "INFO");
        public final static Property PayStatus = new Property(3, String.class, "payStatus", false, "PAY_STATUS");
        public final static Property PayStyle = new Property(4, String.class, "payStyle", false, "PAY_STYLE");
        public final static Property Money = new Property(5, String.class, "money", false, "MONEY");
        public final static Property PayTime = new Property(6, String.class, "payTime", false, "PAY_TIME");
        public final static Property OtherOne = new Property(7, String.class, "otherOne", false, "OTHER_ONE");
        public final static Property OtherTwo = new Property(8, String.class, "otherTwo", false, "OTHER_TWO");
        public final static Property OtherThree = new Property(9, String.class, "otherThree", false, "OTHER_THREE");
        public final static Property OtherFour = new Property(10, String.class, "otherFour", false, "OTHER_FOUR");
    }


    public PayInfoBeanDao(DaoConfig config) {
        super(config);
    }
    
    public PayInfoBeanDao(DaoConfig config, DaoSession daoSession) {
        super(config, daoSession);
    }

    /** Creates the underlying database table. */
    public static void createTable(Database db, boolean ifNotExists) {
        String constraint = ifNotExists? "IF NOT EXISTS ": "";
        db.execSQL("CREATE TABLE " + constraint + "\"PAY_INFO_BEAN\" (" + //
                "\"_id\" INTEGER PRIMARY KEY NOT NULL ," + // 0: id
                "\"TITLE\" TEXT," + // 1: title
                "\"INFO\" TEXT," + // 2: info
                "\"PAY_STATUS\" TEXT," + // 3: payStatus
                "\"PAY_STYLE\" TEXT," + // 4: payStyle
                "\"MONEY\" TEXT," + // 5: money
                "\"PAY_TIME\" TEXT," + // 6: payTime
                "\"OTHER_ONE\" TEXT," + // 7: otherOne
                "\"OTHER_TWO\" TEXT," + // 8: otherTwo
                "\"OTHER_THREE\" TEXT," + // 9: otherThree
                "\"OTHER_FOUR\" TEXT);"); // 10: otherFour
    }

    /** Drops the underlying database table. */
    public static void dropTable(Database db, boolean ifExists) {
        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"PAY_INFO_BEAN\"";
        db.execSQL(sql);
    }

    @Override
    protected final void bindValues(DatabaseStatement stmt, PayInfoBean entity) {
        stmt.clearBindings();
        stmt.bindLong(1, entity.getId());
 
        String title = entity.getTitle();
        if (title != null) {
            stmt.bindString(2, title);
        }
 
        String info = entity.getInfo();
        if (info != null) {
            stmt.bindString(3, info);
        }
 
        String payStatus = entity.getPayStatus();
        if (payStatus != null) {
            stmt.bindString(4, payStatus);
        }
 
        String payStyle = entity.getPayStyle();
        if (payStyle != null) {
            stmt.bindString(5, payStyle);
        }
 
        String money = entity.getMoney();
        if (money != null) {
            stmt.bindString(6, money);
        }
 
        String payTime = entity.getPayTime();
        if (payTime != null) {
            stmt.bindString(7, payTime);
        }
 
        String otherOne = entity.getOtherOne();
        if (otherOne != null) {
            stmt.bindString(8, otherOne);
        }
 
        String otherTwo = entity.getOtherTwo();
        if (otherTwo != null) {
            stmt.bindString(9, otherTwo);
        }
 
        String otherThree = entity.getOtherThree();
        if (otherThree != null) {
            stmt.bindString(10, otherThree);
        }
 
        String otherFour = entity.getOtherFour();
        if (otherFour != null) {
            stmt.bindString(11, otherFour);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, PayInfoBean entity) {
        stmt.clearBindings();
        stmt.bindLong(1, entity.getId());
 
        String title = entity.getTitle();
        if (title != null) {
            stmt.bindString(2, title);
        }
 
        String info = entity.getInfo();
        if (info != null) {
            stmt.bindString(3, info);
        }
 
        String payStatus = entity.getPayStatus();
        if (payStatus != null) {
            stmt.bindString(4, payStatus);
        }
 
        String payStyle = entity.getPayStyle();
        if (payStyle != null) {
            stmt.bindString(5, payStyle);
        }
 
        String money = entity.getMoney();
        if (money != null) {
            stmt.bindString(6, money);
        }
 
        String payTime = entity.getPayTime();
        if (payTime != null) {
            stmt.bindString(7, payTime);
        }
 
        String otherOne = entity.getOtherOne();
        if (otherOne != null) {
            stmt.bindString(8, otherOne);
        }
 
        String otherTwo = entity.getOtherTwo();
        if (otherTwo != null) {
            stmt.bindString(9, otherTwo);
        }
 
        String otherThree = entity.getOtherThree();
        if (otherThree != null) {
            stmt.bindString(10, otherThree);
        }
 
        String otherFour = entity.getOtherFour();
        if (otherFour != null) {
            stmt.bindString(11, otherFour);
        }
    }

    @Override
    public Long readKey(Cursor cursor, int offset) {
        return cursor.getLong(offset + 0);
    }    

    @Override
    public PayInfoBean readEntity(Cursor cursor, int offset) {
        PayInfoBean entity = new PayInfoBean( //
            cursor.getLong(offset + 0), // id
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // title
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // info
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // payStatus
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // payStyle
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // money
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // payTime
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // otherOne
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // otherTwo
            cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // otherThree
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10) // otherFour
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, PayInfoBean entity, int offset) {
        entity.setId(cursor.getLong(offset + 0));
        entity.setTitle(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setInfo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setPayStatus(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setPayStyle(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setMoney(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setPayTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setOtherOne(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setOtherTwo(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setOtherThree(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setOtherFour(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
     }
    
    @Override
    protected final Long updateKeyAfterInsert(PayInfoBean entity, long rowId) {
        entity.setId(rowId);
        return rowId;
    }
    
    @Override
    public Long getKey(PayInfoBean entity) {
        if(entity != null) {
            return entity.getId();
        } else {
            return null;
        }
    }

    @Override
    public boolean hasKey(PayInfoBean entity) {
        throw new UnsupportedOperationException("Unsupported for entities with a non-null key");
    }

    @Override
    protected final boolean isEntityUpdateable() {
        return true;
    }
    
}
